<div class="layui-side layui-bg-black">
	<div class="layui-side-scroll">
		<#include "/apps/business/contacts/include/leftmenu.html">
	</div>
</div>
<div class="layui-body">
	<#include "/apps/business/contacts/include/head.html">
	<div class="layui-tab">
	  <div class="layui-tab-content" style="padding:0px;">
	    <div class="layui-tab-item layui-show">
			<div class="layui-side-scroll">
				<div class="row" >
					<div class="col-lg-12">
						<h1 class="site-h1" style="border-top: 1px solid #eee;">
							坐席（${aggregationList.content?size}）
						</h1>
						<div class="row" style="padding:5px;">
							<div class="col-lg-12">
								<table class="layui-table" lay-skin="line">
									  <thead>
									  <#if aggregationList?? && aggregationList.content?size gt 0>
										<tr>
										  <th>坐席</th>
										  <th>分配数</th>
										  <th>已拨打</th>
										  <th>未拨打</th>
										  <th>拨打成功</th>
										  <th>拨打失败</th>
										  <th>拨打异常</th>
										  <th>未预约</th>
										  <th>已预约</th>
										  <th style="white-space:nowrap;" nowrap="nowrap" width="1%">操作</th>
										</tr> 
										</#if>
									  </thead>
									  <tbody>
									   <#if aggregationList?? && aggregationList.content?size gt 0>
										<#list aggregationList.content as aggregation>
										<tr>
										  <td>
								 			<#if allUserList??>
								 				<#list allUserList as user>
								 					<!-- <a href="/apps/callout/names/myorganuser/data.html?agent=${aggregation.values.id}"> -->
								 					<#if user.id == aggregation.values.id>${user.username!''}</#if>
								 					<!-- </a> -->
								 				</#list>
								 			</#if>
										  </td>
										  <td>
									 		${aggregation.values["total"]!'0'}
										  </td>
										  <td >
										  	${aggregation.values["callstatus.called"]!'0'}
										  </td>
										  <td >
										    <#if aggregation.values["total"!'']?? && aggregation.values["callstatus.called"!'']??>
										  		${aggregation.values["total"!''] - aggregation.values["callstatus.called"!'']} 
										  	<#elseif aggregation.values["total"!'']?? && !aggregation.values["callstatus.called"!'']??>
										  		${aggregation.values["total"!'']}
										  	</#if>
										  </td>
										  <td >
										  	${aggregation.values["workstatus.success"]!'0'}
										  </td>
										  <td >
										  	${aggregation.values["workstatus.faild"]!'0'}
										  </td>
										  <td >
										  	${aggregation.values["workstatus.error"]!'0'}
										  </td>
										  <td >
										  	<#if aggregation.values["total"!'']?? && aggregation.values["apstatus.true"!'']??>
										  		${aggregation.values["total"!''] - aggregation.values["apstatus.true"!'']} 
										  	<#elseif aggregation.values["total"!'']?? && !aggregation.values["apstatus.true"!'']??>
										  		${aggregation.values["total"!'']}
										  	</#if>
										  </td>
										  <td >
										  	${aggregation.values["apstatus.true"!'']}
										  </td>
										 
										 
										<td style="white-space:nowrap;" nowrap="nowrap">
									  		<a href="/apps/contacts/disview/recycle.html?itemid=${itemid!''}&owneruser=${aggregation.values.id!''}" data-toggle="tip" title="回收联系人到项目池子">
									  			<i class="layui-icon">&#xe601;</i>
									  			回收
									  		</a>
									   </td>
										</tr>
										</#list>
										<#else>
											<div class="ukefu-empty">
												<i class="layui-icon"></i>
												<div style="">
													还没有坐席分配记录
												</div>
											</div>
									</#if>
									  </tbody>
									</table>
							</div> 	   
						</div>
						<div class="row" style="padding:5px;">
							<div class="col-lg-12" id="page" style="text-align:center;"></div>
						</div>
					</div>	
				</div>
			</div>
		</div>
	</div>
</div>
<script>
$(document).ready(function(){
	$(".menu-dropdown-a").click(function(){
		  var objpage = $(this).parent().children(".page-list") ;
		  if(objpage.css("display")=="none"){
			  objpage.show();
		  }else{
			  objpage.hide();
		  }
	  });
	$('#batexp').click(function(){
		var ids = "";
		var num = 0 ;
		$('.ids').each(function(){
			if($(this).prop("checked")){
				if(ids!=""){
					ids += "&" ;
				}
				ids += "ids=" + $(this).val();
				num++;
			}
		});
		if(num>0){
			$('#batexp').attr('href' , '/apps/contacts/expids.html?'+ids)	;
		}else{
			top.layer.alert("请先选择需要导出的联系人信息");
			$('#batexp').attr("href" , "javascript:void(0)");
		}
	});
	$('#batdel').click(function(){
		var ids = "";
		var num = 0 ;
		$('.ids').each(function(){
			if($(this).prop("checked")){
				if(ids!=""){
					ids += "&" ;
				}
				ids += "ids=" + $(this).val();
				num++;
			}
		});
		if(num>0){
			$('#batdel').attr('href' , '/apps/contacts/batdel.html?itemid=${itemid!''}&ckind=${ckind!''}&p=<#if contactsList??>${contactsList.number+1}<#else>0</#if>&'+ids)	;
		}else{
			top.layer.alert("请先选择需要删除的联系人信息");
			$('#batdel').attr("href" , "javascript:void(0)");
		}
	});
	$('#dischecked').click(function(){
		var ids = "";
		var num = 0 ;
		$('.ids').each(function(){
			if($(this).prop("checked")){
				if(ids!=""){
					ids += "&" ;
				}
				ids += "ids=" + $(this).val();
				num++;
			}
		});
		if(num>0){
			$('#dischecked').attr('href' , '/apps/contacts/dis.html?size=${contactsList.totalElements}<#if itemid??>&itemid=${itemid}<#elseif ckind??>&ckind=${ckind}</#if><#if filterCriteria??>&filter=${filterCriteria}</#if><#if organ??>&organ=${organ!''}</#if>&'+ids)	;
		}else{
			top.layer.alert("请先选择需要分配的联系人");
			$('#dischecked').attr("href" , "javascript:void(0)");
		}
	});
	$('#recyclechecked').click(function(){
		var ids = "";
		var num = 0 ;
		$('.ids').each(function(){
			if($(this).prop("checked")){
				if(ids!=""){
					ids += "&" ;
				}
				ids += "ids=" + $(this).val();
				num++;
			}
		});
		if(num>0){
			$('#recyclechecked').attr('href' , '/apps/contacts/recycle.html?size=${contactsList.totalElements}<#if itemid??>&itemid=${itemid}<#elseif ckind??>&ckind=${ckind}</#if><#if filterCriteria??>&filter=${filterCriteria}</#if>&'+ids)	;
		}else{
			top.layer.alert("请先选择需要回收的联系人");
			$('#recyclechecked').attr("href" , "javascript:void(0)");
		}
	});
});
layui.use(['laypage', 'layer'], function(){
	  var laypage = layui.laypage
	  ,layer = layui.layer;
	  
	  laypage.render({
			elem: 'page'
			,pages: <#if contactsList??>${contactsList.totalPages}<#else>0</#if> //总页数
			,curr:<#if contactsList??>${contactsList.number+1}<#else>0</#if>
			,groups: 5 //连续显示分页数
			,jump:function(data , first){
				if(!first){
					location.href = "/apps/contacts/${subtype!'index'}.html?p="+data.curr+"&itemid=${itemid!''}&ckind=${ckind!''}&qualitystatus=${qualitystatus!''}&hangupcase=${hangupcase!''}";
				}
			}
	   });
	});
</script>
